package com.ibeeking.gmc.global.g.rest.controller.v1.feign;

import com.ibeeking.gmc.global.api.common.dto.TenantBankDTO;
import com.ibeeking.gmc.global.api.common.param.TenantBankParam;
import com.ibeeking.gmc.global.g.rest.service.ITenantBankService;
import com.ibeeking.nematos.utils.base.BaseValidationGroup;
import com.ibeeking.nematos.utils.bean.BeanUtil;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName TenantBankFeignController
 * @Description
 * @Author ibeeking
 * @Date 2021-01-14 13:53
 **/
@RestController
@RequestMapping("/g/tenantbank/feign/v1")
public class TenantBankFeignController {

	@Resource
	private ITenantBankService iTenantBankService;


	@PostMapping(value = "/modifyBank")
	public Boolean modifyBank(@RequestBody @Validated(BaseValidationGroup.Update.class) TenantBankParam tenantBankParam) {
		com.ibeeking.gmc.global.service.common.param.TenantBankParam param = BeanUtil.convertBean(tenantBankParam, com.ibeeking.gmc.global.service.common.param.TenantBankParam.class);
		return  iTenantBankService.modify(param);
	}

	@PostMapping(value = "/queryTenantBankByTenantId/{id}")
	public TenantBankDTO queryTenantBankByTenantId(@PathVariable("id") Integer id) {
		TenantBankDTO dto = BeanUtil.convertBean(iTenantBankService.queryByTenantId(id), TenantBankDTO.class);
		return dto;
	}




}